from django.db import models
from django.contrib.auth.models import User


class Question(models.Model):
    STATUS_OPEN = 1
    STATUS_CLOSED = 2
    STATUS_CHOICES = (
        (STATUS_OPEN, "开放"),
        (STATUS_CLOSED, "关闭"),
    )

    asker = models.ForeignKey(User)
    title = models.CharField(max_length=100)
    desc  = models.TextField()
    posttime = models.DateTimeField(auto_now=True)
    status = models.PositiveIntegerField()


class Answer(models.Model):
    user = models.ForeignKey(User)
    content = models.TextField()
    istop = models.BooleanField(default=False)
    posttime = models.DateTimeField(auto_now=True)


